PROJECT = "短信转发器"
VERSION = "1.0.0"

-- sys库是标配
_G.sys = require("sys")
--[[特别注意, 使用http库需要下列语句]]
_G.sysplus = require("sysplus")

-- Air780E的AT固件默认会为开机键防抖, 导致部分用户刷机很麻烦
if rtos.bsp() == "EC618" and pm and pm.PWK_MODE then
    pm.power(pm.PWK_MODE, false)
end

sys.taskInit(function()
    local req_headers = {}
    req_headers["Content-Type"] = "application/json"

    local body = json.encode({text={ content="1短信测试成功" }, msgtype="text" })
    
    local code, headers, body = http.request("POST","https://oapi.dingtalk.com/robot/send?access_token=083f2a63bb3afe0e5186ba09b0ad16ab403b0ef71dba2108c0db3748b7c8d31e", 
            req_headers,
            body -- POST请求所需要的body, string, zbuff, file均可
    ).wait()
    log.info("http.post", code, headers, body)

end)



-- 短信接收回调
sms.setNewSmsCb(function(num, txt, metas)
    log.info(PROJECT, "发件人：", num)
    log.info(PROJECT, "内容：", txt)
end)


-- 用户代码已结束---------------------------------------------
-- 结尾总是这一句
sys.run()
